package com.biyu.monitormanage.enums;

import java.util.Objects;

/**
 * @author 15491
 */

public enum MonitorStatusEnums {

    /**
     * 安全
     */
    SAFE(0, "无异常"),

    /**
     * 危险
     */
    DANGER(1, "危险"),

    /**
     * 关闭
     */
    TURN_DOWN(1, "关闭")
    ;


    private Integer code;

    private String desc;

    MonitorStatusEnums(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 遍历获取描述
     * @param code code码
     * @return 描述
     */
    public static String getDesc(Integer code) {
        if (Objects.nonNull(code)) {
            for (MonitorStatusEnums statusEnums : MonitorStatusEnums.values()) {
                if (Objects.equals(code, statusEnums.getCode())) {
                    return statusEnums.getDesc();
                }
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
